package com.gopay.common.cps.dao.fund;


import com.gopay.common.domain.cps.CpsGenMainOrder;
import com.gopay.common.domain.cps.CpsGenPayOrder;
import com.gopay.common.domain.fund.FundGopayBankcardInfoEntity;
import com.gopay.common.domain.fund.FundGopayCardEntity;
import com.gopay.common.domain.fund.FundGopayCpsGenOrder;
import com.gopay.common.domain.fund.FundGopayFileEntity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * @author baiyunpeng
 * @2016年7月14日 下午3:36:05  www.gopay.com.cn Inc.All rights reserved.
 */
public interface BindCardBaseDAO {

    /**
     * 获取bean
     * @param obj
     * @return
     */
    Object get(Object obj);

    /**
     * 更新卡
     * @param agentSignNo
     * @param type
     * @return
     */
    Integer updateCard(Serializable agentSignNo, Serializable type);

    /**
     * 更新卡信息
     * @param agentSignNo
     * @param type
     * @param keyid
     * @return
     */
    Integer updateCardInfo(Serializable agentSignNo, Serializable type,String keyid);

    /**
     * 查找bean
     * @param agentSignNo
     * @param merId
     * @param type
     * @return
     */
    Object find(Serializable agentSignNo,Serializable merId,Serializable type);

    /**
     * 更新网关流水--卡查询
     * @param cardNo
     * @param bankCode
     * @param mobile
     * @param seq
     * @param memo
     * @param date
     * @return
     */
    Integer updateDtlForCardInfo(Serializable cardNo, Serializable bankCode, Serializable mobile, Serializable seq, Serializable memo,Date date);

    /**
     * 获取卡
     * @param id
     * @param agenSignNo
     * @return
     */
    FundGopayBankcardInfoEntity getEntity(String id, String agenSignNo);

    /**
     * 保存订单
     * @param fundGopayBankcardInfoEntity
     * @param fundGopayCardEntity
     */
    void saveOrder( FundGopayBankcardInfoEntity fundGopayBankcardInfoEntity,  FundGopayCardEntity fundGopayCardEntity);

    /**
     * 解卡
     * @param fundGopayBankcardInfoEntity
     * @param fundGopayCardEntity
     */
    void unBindCard( FundGopayBankcardInfoEntity fundGopayBankcardInfoEntity,  FundGopayCardEntity fundGopayCardEntity);

    /**
     * 保存0文件订单
     * @param orderList
     * @param mainOrderList
     */
    void saveZeroOrder(final List<FundGopayCpsGenOrder> orderList, final List<CpsGenMainOrder> mainOrderList);

    /**
     * 保存赎回订单
     * @param orderList
     * @param mainOrderList
     * @param cpsGenPayOrderList
     * @param map
     * @param key
     */
     void saveThreeOrder(final List<FundGopayCpsGenOrder> orderList, final List<CpsGenMainOrder> mainOrderList, final List<CpsGenPayOrder> cpsGenPayOrderList, final Map<String, Object> map, final String key);

    /**
     * 保存赎回文件
     * @param fundOrderMaps
     * @param orderMaps
     * @param fileEntity
     * @param fundCpsMainOrder
     * @param cpsMainOrder
     * @return
     */
    FundGopayFileEntity saveThreeFile( Map<String,Object> fundOrderMaps,  Map<String,Object> orderMaps,  FundGopayFileEntity fileEntity, FundGopayCpsGenOrder fundCpsMainOrder,CpsGenMainOrder cpsMainOrder);

    /**
     * 根据订货根据差异文件
     * @param maps
     */
    void updateSuccessOrderCauseDiffer( Map<String,Map<String,Object>> maps);

    /**
     * 根据订货根据差异文件
     * @param toatlMap
     */
    void updateFailOrderCauseDiffer(Map<String, Map<String, Object>> toatlMap);

    /**
     * 检查金额
     * @param maps
     * @return
     */
    boolean checkerMoney(Map<String, Object> maps);

    /**
     * 更新主从表
     * @param fundOrderMaps
     * @param orderMaps
     */
    void updateMainAndFundOrder(Map<String, Object> fundOrderMaps, Map<String, Object> orderMaps);

    /**
     * 更新卡
     * @param fundGopayCardEntity
     * @param fundGopayBankcardInfoEntity
     */
    void updateCardByBind(FundGopayCardEntity fundGopayCardEntity, FundGopayBankcardInfoEntity fundGopayBankcardInfoEntity);
    void update02018And02012OrderState(String gopayId,String orderType);

    /**
     * 根据条件查询基金支付绑卡信息
     * agentSignNo-签约协议号，merchantId-基金公司在国付宝的客户号，cardNo-卡号加密后的查询数据列表
     * @param param
     * @return
     */
    List<FundGopayCardEntity> getBindCard(Map<String, Object> param);
}